import time
import threading


class cThread(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self._stop_event = threading.Event()
        self.count = 0
        self.xlist = []
        self.ylist = []

    def run(self):
        print('开始线程')
        self.operation()

    def stop(self):
        self._stop_event.set()

    def stopped(self):
        return self._stop_event.is_set()

    def operation(self, a=1, b=2, c=100):
        i = 0
        while i < 10000:
            i += 1
            y = a * i * i + b * i + c
            print('当前x为: %d,y为: %d' % (i, y))
            self.xlist.append(i)
            self.ylist.append(y)
            if self.stopped():
                break
            time.sleep(1)

    def showTable(self):
        return (self.xlist, self.ylist)
